export default {
  namespaced : true,
  state : {
    adress : JSON.parse(uni.getStorageSync('adress') || '{}'),
    // token : uni.getStorageSync('token') || '',
    token : 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo',
    userInfo : JSON.parse(uni.getStorageSync('userInfo') || '{}'),
    redirectInfo : {}
  },
  mutations : {
    updateAdress(state,adress) {
      state.adress = adress
      this.commit('m_user/saveStorage',adress)
    },
    saveStorage(state,adress) {
      uni.setStorageSync('adress',JSON.stringify(adress))
    },
    updateUserInfo(state,userInfo) {
      state.userInfo = userInfo
      uni.setStorageSync('userInfo',JSON.stringify(userInfo))
    },
    updateToken(state,token) {
      state.token = token
      uni.setStorageSync('token',token)
    },
    updateRedirect(state,info) {
      state.redirectInfo = info
    }
  },
  getters : {
    adressFull (state) {
      if (state.adress.provinceName == '') return ''
      return state.adress.provinceName + state.adress.cityName + state.adress.countyName + state.adress.detailInfo
    }
  },
}